// package-market/pages/lottery-edit-background/index.js
const app = getApp();
import { navBack } from '../../../common/env';
import { DEFAULT_BG_LIST } from '../../../constants/common';

Page({
    data: {
        activityInfo: {},
        list: [],
    },
    onLoad(options) {
        app.event.addListener('sendLotteryActivityInfo', this._handleSendActivity.bind(this));
        this.setData({
            list: DEFAULT_BG_LIST,
        });
    },
    onUnload() {
        app.event.removeListener('sendLotteryActivityInfo');
    },
    _handleSendActivity(activityInfo) {
        this.setData({
            activityInfo,
        });
    },
    handleSave(e) {
        const { activityInfo } = this.data;
        activityInfo.background = e.detail;
        app.event.trigger('getLotteryActivityInfo', activityInfo);
        navBack();
    },
})
